xen: Understand the E820_UNUSABLE (type code 5) memory type.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 30 Aug 2007 10:01:39 +0000 (11:01 +0100)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Thu, 30 Aug 2007 10:01:39 +0000 (11:01 +0100)
Signed-off-by: Joseph Cihula <joseph.cihula@intel.com>
Signed-off-by: Keir Fraser <keir@xensource.com>
xen/arch/x86/domain_build.c
xen/arch/x86/e820.c
xen/arch/x86/mm.c
xen/arch/x86/setup.c
xen/include/asm-x86/e820.h

index 4cfd0433c1367cf0bb17868682df0e9e1ed91d76..a7927c6f63c2234a612a37518e3795c9b054862a 100644 (file)
@@ -989,6 +989,16 @@ int __init construct_dom0(
             rc |= iomem_deny_access(dom0, mfn, mfn);
     }
 
+    /* Remove access to E820_UNUSABLE I/O regions. */
+    for ( i = 0; i < e820.nr_map; i++ )
+    {
+        if ( e820.map[i].type != E820_UNUSABLE)
+            continue;
+        mfn = paddr_to_pfn(e820.map[i].addr);
+        nr_pages = (e820.map[i].size + PAGE_SIZE - 1) >> PAGE_SHIFT;
+        rc |= iomem_deny_access(dom0, mfn, mfn + nr_pages - 1);
+    }
+
     BUG_ON(rc != 0);
 
     return 0;
index 797ccc0a7e7ea7e47de42d9931e754134903330f..835a0f76f352d4b49cd886e6ba57ff84a7f669de 100644 (file)
@@ -41,7 +41,8 @@ static void __init print_e820_memory_map(struct e820entry *map, int entries)
                (unsigned long long)(map[i].addr),
                (unsigned long long)(map[i].addr + map[i].size));
         switch (map[i].type) {
-        case E820_RAM: printk("(usable)\n");
+        case E820_RAM:
+            printk("(usable)\n");
             break;
         case E820_RESERVED:
             printk("(reserved)\n");
@@ -52,7 +53,11 @@ static void __init print_e820_memory_map(struct e820entry *map, int entries)
         case E820_NVS:
             printk("(ACPI NVS)\n");
             break;
-        default:       printk("type %u\n", map[i].type);
+        case E820_UNUSABLE:
+            printk("(unusable)\n");
+            break;
+        default:
+            printk("type %u\n", map[i].type);
             break;
         }
     }
index 9af4f6ff5f6691ec541aff3367b34b7de30f7218..5ff93f4d341dde997873345bd471442d6a1cb4b2 100644 (file)
@@ -213,7 +213,9 @@ void __init arch_init_memory(void)
     /* Any areas not specified as RAM by the e820 map are considered I/O. */
     for ( i = 0, pfn = 0; pfn < max_page; i++ )
     {
-        while ( (i < e820.nr_map) && (e820.map[i].type != E820_RAM) )
+        while ( (i < e820.nr_map) &&
+                (e820.map[i].type != E820_RAM) &&
+                (e820.map[i].type != E820_UNUSABLE) )
             i++;
 
         if ( i >= e820.nr_map )
index 3a6c3d7a6a4f006ffd6e076725e175c9c4a40bfc..31d669a2078b0c74df34fdd8b94659cbe58c8c87 100644 (file)
@@ -610,8 +610,7 @@ void __init __start_xen(unsigned long mbi_p)
                 ((u64)map->base_addr_high << 32) | (u64)map->base_addr_low;
             e820_raw[e820_raw_nr].size = 
                 ((u64)map->length_high << 32) | (u64)map->length_low;
-            e820_raw[e820_raw_nr].type = 
-                (map->type > E820_NVS) ? E820_RESERVED : map->type;
+            e820_raw[e820_raw_nr].type = map->type;
             e820_raw_nr++;
 
             bytes += map->size + 4;
index 1d3a981f2ee3380883d49b3e0b2c54cf8324a091..69643949ad3e4b3148f9462aa73ea85badaab28b 100644 (file)
@@ -8,6 +8,7 @@
 #define E820_RESERVED     2
 #define E820_ACPI         3
 #define E820_NVS          4
+#define E820_UNUSABLE     5
 
 struct e820entry {
     uint64_t addr;